import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '年度',
    align: "center",
    dataIndex: 'year'
  },
  {
    title: '公司名称',
    align: "center",
    dataIndex: 'companyName'
  },
  {
    title: '科目分组',
    align: "center",
    dataIndex: 'subjectGroup'
  },
  {
    title: '科目编码',
    align: "center",
    dataIndex: 'subjectNumber'
  },
  {
    title: '发生金额',
    align: "center",
    dataIndex: 'totalMoney'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "年度",
    field: 'year',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "公司名称",
    field: 'companyName',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "科目分组",
    field: 'subjectGroup',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "科目编码",
    field: 'subjectNumber',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '年度',
    field: 'year',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入年度!'},
             ];
    },
  },
  {
    label: '公司名称',
    field: 'companyName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入公司名称!'},
             ];
    },
  },
  {
    label: '科目分组',
    field: 'subjectGroup',
    component: 'Input',
  },
  {
    label: '科目编码',
    field: 'subjectNumber',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入科目编码!'},
             ];
    },
  },
  {
    label: '发生金额',
    field: 'totalMoney',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入发生金额!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
